package dp;

public class FibonacciNumber509 {
    public int fib(int n) {
        int p = 0;
        int pp = 1;
        if(n==0){
            return p;
        }
        if(n == 1){
            return pp;
        }
        for (int i = 2; i < n; i++) {
            int ss = p+pp;
            p = pp;
            pp = ss;
        }
        return pp+p;
    }
}
